//
//  UCMapView+Animation.m
//  AeroMapSDK
//
//  Created by 北京国泰北斗科技有限公司 on 2017/3/22.
//  Copyright © 2017年 北京国泰北斗科技有限公司. All rights reserved.
//

#import "UCMapView+Animation.h"
#import "UCCoordinateBounds.h"
#import <GoogleMaps/GoogleMaps.h>

@implementation UCMapView (Animation)

- (void)animationToBounds:(UCCoordinateBounds *)bounds{

    GMSMapView *mapView = [self valueForKey:@"map"];
    GMSCoordinateBounds *bound = [bounds valueForKey:@"_gmBounds"];
    GMSCameraUpdate *update = [GMSCameraUpdate fitBounds:bound];
    [mapView animateWithCameraUpdate:update];
}

- (void)animationToZoom:(float)zoom{

    GMSMapView *mapView = [self valueForKey:@"map"];
    if (zoom == kAMMaxZoomLevel) {
        [mapView animateToZoom:kGMSMaxZoomLevel];
    }else if (zoom == kAMMinZoomLevel){
        [mapView animateToZoom:kGMSMinZoomLevel];
    }else{
        [mapView animateToZoom:zoom];
    }
}
@end
